/**
 * 
 */
package com.jm.web.form;

import com.jm.utils.StringHelper;
import com.jm.web.form.support.FieldItem;
import com.jm.web.form.support.FormItem;

/**
 * @author yanjie
 *
 * 2011/10/6 下午1:42:44
 */
public class Select extends FieldItem{
	public final static String TAG_ITEMNAME = "select";

	/**
	 * @param tag
	 */
	public Select() {}
	
	@Override
	public void init() {
		super.init();
		this.setNodeName(TAG_ITEMNAME);
	}
	
	public static boolean isSelect(FormItem item){
		if(item == null)
			return false;
		
		return item instanceof Select ;
	}
	
	@Override
	public String getNodeValue() {
		if(!StringHelper.IsNullOrEmpty(super.getNodeValue()))
			return super.getNodeValue();
		return StringHelper.getValue(this.getBaseTag().getPage().getSelectData().get(this.getId()));
	}
}
